
import React, { ReactElement, useEffect } from "react"
import { $StopPropagation } from "../../common/utils"
import lessModule from "./index.module.less"

// 主页-抽屉组件
interface homePageDrawerComponentPropsInterface {
    top?: number
    isPrepareCloseDrawer: boolean
    get_isDrawerClose: Function
    DrawerContentComponents: ReactElement
}
const HomePage_DrawerComponent: React.FC<homePageDrawerComponentPropsInterface> = (props) => {

    const click_mask = () => {
        props.get_isDrawerClose(false)
    }
    return (
        <div className={`${lessModule["homePageDrawerComponent"]}`} style={{ top: props.top ?? 0 }} onClick={() => click_mask()}>
            <div className={`${lessModule["homePageDrawerComponent-content"]} ${lessModule["homePageDrawerComponent-contentOpen"]} ${props.isPrepareCloseDrawer && lessModule["homePageDrawerComponent-contentClose"]}`} onClick={(e) => $StopPropagation(e)}>
                <>
                    {props.DrawerContentComponents}
                </>
            </div>
        </div>
    )
}

export default HomePage_DrawerComponent